<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<!-- 上传部分 -->
<link href="${path}/static/uploadify/uploadify.css" rel="stylesheet" type="text/css">
<script type="text/javascript"  src="${path}/static/uploadify/jquery.uploadify.js"></script>

<script type="text/javascript">
    $(function() {
        $("#photo_upload").uploadify({
            'height'        : 27,
            'width'         : 80,
            'buttonText'    : '更换商品图片',
            'swf': '${path}/static/uploadify/uploadify.swf',
            'uploader': '${path}/appCarouselFigure/uploadPhoto',
            'cancelImg': '${path}/static/uploadify/uploadify-cancel.png',
            'auto'          : true, //设置auto为true，当文件被添加至上传队列时，将会自动上传。
            'fileSizeLimit' : '512000KB', // 50M
            'fileTypeExts'  : '*.jpg;*.jpeg;*.png;*.unity3d;*.gif;*.ps;*.bmp;',
            'uploadLimit' : 100,
            'onUploadStart' : function(file) {

            },
            'onUploadSuccess':function(file, data, response){
                data = $.parseJSON( data );
                console.info(data.msg);
                if(data.success){
                    $("#title_img").val(data.msg);
                }else{
                    $("#title_img").val("");
                }
            },
            'onUploadComplete':function(res){
            }
        });

        $('#appCarouselFigureEditForm').form({
            url : '${path }/appCarouselFigure/edit',
            onSubmit : function() {
                progressLoad();
                var isValid = $(this).form('validate');
                if (!isValid) {
                    progressClose();
                }
                return isValid;
            },
            success : function(result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.success) {
                    parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                    parent.$.modalDialog.handler.dialog('close');
                } else {
                    parent.$.messager.alert('错误', result.msg, 'error');
                }
            }
        });
            $("#appCarouselFigureEditType").val('${appCarouselFigure.type}');
            $("#appCarouselFigureEditName").val('${appCarouselFigure.name}');
            $("#appCarouselFigureEditStatus").val('${appCarouselFigure.status}');
    });
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;">
        <form id="appCarouselFigureEditForm" method="post">
            <table class="grid">
                <tr>
                    <td>类型</td>
                    <td >
                        <input name="id" type="hidden"  value="${appCarouselFigure.id}">
                         ${appCarouselFigure.type}
                    </td>
                </tr>
                <tr>
                    <td>编号</td>
                    <td >
                        ${appCarouselFigure.index}
                    </td>
                </tr>
                <tr>
                    <td>名称</td>
                    <td >
                        ${appCarouselFigure.name}
                    </td>
                </tr>
                <tr>
                    <td>状态</td>
                    <td >
                        <c:if test="${appCarouselFigure.status==0}">
                            <c:out value="启用"/>
                        </c:if>
                        <c:if test="${appCarouselFigure.status==1}">
                            <c:out value="禁用"/>
                        </c:if>
                    </td>
                </tr>
                <tr>
                    <td>图片</td>
                    <td colspan="3">
                        <input id="photo_upload" name="photo_up" type="file" multiple="true">
                        <input type="hidden" name="title_img" id="title_img" value="${appCarouselFigure.title_img}" data-options="required:ture">
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>